import time
# Ellie骑紫色的车，Rohan没有骑绿色的车。
# Mike和Ellie不是第一，也不是最后。
# 骑蓝色车的人领先Fatma。
# 骑绿色车的人领先骑紫色车的人

# 此方法为列出全排列仅用576种情况
mike=ellie=rohan=fatma=0
red=violet=bule=green=0
set1=[1,2,3,4]
count = 0;
flag = 0;
start = time.time()
for mike in set1:
    if flag == 1:
        break
    set2 = set1.copy()
    set2.remove(mike)
    #print(set2,set1)
    for ellie in set2:
        if flag == 1:
            break
        set3 = set2.copy()
        set3.remove(ellie)
        for rohan in set3:
            if flag == 1:
                break
            set4 = set3.copy()
            set4.remove(rohan)
            fatma = set4[0]
            for red in set1:
                if flag == 1:
                    break
                set5 = set1.copy()
                set5.remove(red)
                # print(set2,set1)
                for violet in set5:
                    if flag == 1:
                        break
                    set6 = set5.copy()
                    set6.remove(violet)
                    for bule in set6:
                        if flag == 1 :
                            break
                        set7 = set6.copy()
                        set7.remove(bule)
                        green = set7[0]
                        count += 1
                        if red!=violet and red!=green and red!=bule and violet!=bule and violet!=green and bule!=green and ellie==violet and rohan!=green and mike!=1 and mike!=4 and ellie!=1 and ellie!=4 and bule<fatma and green<violet :
                            if mike == 2 :
                                print("第二名是mike")
                            if ellie == 2 :
                                print("第二名是ellie")
                            if rohan == 2 :
                                print("第二名是rohan")
                            if fatma == 2 :
                                print("第二名是fatma")
                            flag = 1
                            end = time.time()
                            print("花费时间"+str((end-start)*1000)+"ms")
                            break
                        #print(mike, ellie, rohan, fatma)
                        #print(red,violet,bule,green)
                        #print()

#print(count)